import TabsView from '@/layouts/tabs/TabsView'
import PageView from '@/layouts/PageView'

// 路由配置
const options = {
  routes: [
    {
      path: '/login',
      name: '登录页',
      component: () => import('@/pages/login/Login')
    },
    {
      path: '*',
      name: '404',
      component: () => import('@/pages/exception/404'),
    },
    {
      path: '/403',
      name: '403',
      component: () => import('@/pages/exception/403'),
    },
    {
      path: '/',
      name: '首页',
      component: TabsView,
      redirect: '/login',
      children: [
        {
          path: 'datadashbord',
          name: '数据看板',
          meta: {
            icon: 'dashboard',
            authority: {
              role: 'tenant'
            }
          },
          component: () => import('@/pages/siot/dashboard/Dashboard'),
        },
        {
          path: 'admindatadashbord',
          name: '数据看板',
          meta: {
            icon: 'dashboard',
            authority: {
              role: 'admin'
            }
          },
        },
        {
          path: 'sysconfig',
          name: '系统配置',
          meta: {
            icon: 'setting',
            authority: {
              role: 'admin'
            }
          },
          component: PageView,
          children: [
            {
              path: 'setting',
              name: '基础设置',
              meta: {
                icon: 'setting',
              },
              component: () => import('@/pages/siot/sysConfig/EditSysConfig'),
            },
            {
              path: 'dict',
              name: '数据字典',
              meta: {
                icon: 'setting',
              },
              component: () => import('@/pages/siot/DictList'),
            },
            {
              path: 'dict/detail/:id',
              name: '字典数据详情',
              meta: {
                invisible: true
              },
              component: () => import('@/pages/siot/dict/DictDetail')
            },
              {
              path: 'dict/edit/:id',
              name: '编辑字典数据',
              meta: {
                invisible: true
              },
              component: () => import('@/pages/siot/dict/EditDictForm')
            },
          ]
        },
        {
          path: 'siotadmin',
          name: '租户管理',
          meta: {
            icon: 'user',
            authority: {
              role: 'admin'
            }
          },
          component: PageView,
          children: [
            {
              path: 'tenantlist',
              name: '租户列表',
              meta: {
                icon: 'table',
              },
              component: () => import('@/pages/siot/TenantList'),
            },
            {
              path: 'addtenant',
              name: '新增租户',
              meta: {
                icon: 'form',
              },
              component: () => import('@/pages/siot/tenant/TenantForm'),
            },
            {
              path: 'tenant/detail/:id',
              name: '租户详情',
              meta: {
                invisible: true
              },
              component: () => import('@/pages/siot/tenant/TenantDetail')
            },
            {
              path: 'tenant/edit/:id',
              name: '编辑租户',
              meta: {
                invisible: true
              },
              component: () => import('@/pages/siot/tenant/EditTenantForm')
            },
          ]
        },
        {
          path: 'product',
          name: '产品管理',
          meta: {
            icon: 'dashboard',
            authority: {
              role: 'tenant'
            }
          },
          component: PageView,
          children: [
            {
              path: 'productlist',
              name: '产品列表',
              meta: {
                icon: 'table',
              },
              component: () => import('@/pages/siot/ProductList'),
            },
            {
              path: 'addproduct',
              name: '新增产品',
              meta: {
                icon: 'form',
              },
              component: () => import('@/pages/siot/product/ProductForm'),
            },
            {
              path: 'product/detail/:id',
              name: '产品详情',
              meta: {
                invisible: true
              },
              component: () => import('@/pages/siot/product/ProductDetail')
            },
            {
              path: 'product/edit/:id',
              name: '编辑产品',
              meta: {
                invisible: true
              },
              component: () => import('@/pages/siot/product/edit/ProductForm')
            },
          ]
        },
        {
          path: 'device',
          name: '设备管理',
          meta: {
            icon: 'dashboard',
            authority: {
              role: 'tenant'
            }
          },
          component: PageView,
          children: [
            {
              path: 'devicelist',
              name: '设备列表',
              meta: {
                icon: 'table',
              },
              component: () => import('@/pages/siot/DeviceList'),
            },
            {
              path: 'adddevice',
              name: '新增设备',
              meta: {
                icon: 'form',
              },
              component: () => import('@/pages/siot/device/DeviceForm'),
            },
            {
              path: 'device/edit/:id',
              name: '编辑设备',
              meta: {
                invisible: true
              },
              component: () => import('@/pages/siot/device/EditDeviceForm')
            },
            {
              path: 'device/detail/:id',
              name: '设备详情',
              meta: {
                invisible: true
              },
              component: () => import('@/pages/siot/device/DeviceDetail')
            },
          ]
        },
        {
          path: 'datademo',
          name: '数据仿真',
          meta: {
            icon: 'dashboard',
            authority: {
              role: 'tenant'
            }
          },
          component: () => import('@/pages/siot/datademo/DataDemo'),
        },
      ]
    },
  ],
}

export default options
